﻿package mortal.game.view.shopMall.view
{
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class ShopMallCellRender extends GCellRenderer
    {
        private var _shopIcon:GBitmap;
        private var _styleName:String;
        private var _isLoaded:Boolean;

        public function ShopMallCellRender()
        {
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:GBitmap = null;
            var _loc_2:GBitmap = null;
            var _loc_3:GBitmap = null;
            if (!this._isLoaded)
            {
                var _loc_4:* = new GBitmap();
                _loc_3 = new GBitmap();
                var _loc_4:* = _loc_4;
                _loc_1 = _loc_4;
                _loc_2 = _loc_4;
            }
            else
            {
                _loc_1 = GlobalClass.getBitmap(ImagesConst.ShopMall_upSkin);
                _loc_2 = GlobalClass.getBitmap(ImagesConst.ShopMall_overSkin);
                _loc_3 = GlobalClass.getBitmap(ImagesConst.ShopMall_disabledSkin);
            }
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_3);
            this.setStyle("selectedOverSkin", _loc_3);
            this.setStyle("selectedUpSkin", _loc_3);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._shopIcon = UIFactory.gBitmap("", 9, 3, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._shopIcon.dispose(param1);
            this._shopIcon = null;
            this._isLoaded = false;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._styleName = param1.styleName;
            LoaderHelp.addResCallBack(ResFileConst.ShopMallTab, this.showSkin);
            return;
        }// end function

        private function showSkin() : void
        {
            if (this._disposed)
            {
                return;
            }
            this._shopIcon.bitmapData = GlobalClass.getBitmapData(this._styleName);
            this._isLoaded = true;
            this.initSkin();
            return;
        }// end function

    }
}
